<template>
    <div class="cart-list-item">
        <div class="button">
            <check-button :isChecked="cartItem.checked" @click.native="buttonClick"></check-button>
        </div>
        <div class="img">
            <img :src="cartItem.image" alt="">
        </div>
        <div class="info">
            <ul>
                <li>{{cartItem.title}}</li>
                <li>{{cartItem.desc}}</li>
                <li>
                    <span>￥{{cartItem.price}}</span>
                    <span>x{{cartItem.count}}</span>
                </li>
            </ul>
        </div>
    </div>
</template>

<script>
import CheckButton from 'components/content/checkButton/CheckButton'

export default {
    components: {
        CheckButton,
    },
    props: {
        cartItem: {
            type: Object,
            default() {
                return {}
            }
        }
    },
    methods: {
        buttonClick() {
            this.cartItem.checked = !this.cartItem.checked
        }
    }
}
</script>

<style scoped>
    .cart-list-item{
        display: flex;
        padding: 8px 8px 8px 5px;
        border-bottom: 1px solid #ccc;
        
    }

    .cart-list-item .img img{
        width: 80px;
        border-radius: 6px;
    }

    .cart-list-item .info{
        padding: 6px 6px 0 15px;
        /* width: 287.8px; */
        overflow: hidden;
    }

    .cart-list-item .info li{
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        margin-bottom: 20px;
    }

    .cart-list-item .info li:nth-child(1){
        font-size: 19px;
        color: #333;
    }

    .cart-list-item .info li:nth-child(3){
        display: flex;
        justify-content: space-between;
    }

    .cart-list-item .info li span:nth-child(1){
        color: #f55d00;
        font-size: 20px;
    }

    .button{
        /* width: 20px; */
        display: flex;
        text-align: center;
        align-items: center;
        margin-right: 5px;
    }
    
</style>